﻿<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="zh_CN">
<head>
<%@ include file="../common/header.jsp"%>
</head>
<body>

	<div class="container " style="margin-top: 20px">
		<%@ include file="../common/top.jsp"%>

		<div class="row">
			<div class="col-sm-3">
				<c:set var="menu" value="employee" />
				<%@ include file="../common/menu.jsp"%>
			</div>
			<div class="col-sm-9">
				<div class="row">
					<div class="col-sm-12">
						<h1 class="page-head-line">员工编辑</h1>
					</div>
				</div>
				<div class="row col-sm-10">
					<form class="form-horizontal" action="/employee/saveOrUpdate.do"
						method="post" id="editForm">
						<input type="hidden" name="id" value="${e.id}">
						<div class="form-group">
							<label class="col-sm-2 control-label">用户名：</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="name"
									value="${e.name}" placeholder="请输入用户名">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label">Email：</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="email"
									value="${e.email}" placeholder="请输入邮箱">
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label">年龄：</label>
							<div class="col-sm-6">
								<input type="text" class="form-control" name="age"
									value="${e.age}" placeholder="请输入年龄">
							</div>
						</div>
						
						<div class="form-group">
                        <label for="dept" class="col-sm-2 control-label">部门：</label>
                        <div class="col-sm-6">
                            <select class="form-control" id="dept" name="dept.id">
                             <c:if test="${e.dept.id==null}">
                                <option value="" disabled selected hidden>选择部门</option>
                             </c:if>
                             <c:if test="${e.dept.id!=null}">
                              	<option value="" disabled selected hidden>${e.dept.name}</option>
                             </c:if>
                             <c:forEach var="d" items="${depts}">
                              	<option value="${d.id}">${d.name}</option>
                         	 </c:forEach>
                            </select>
       						<script>
       							 $("#dept").val(${e.dept.id});
                            </script>
                        </div>
						
						<div class="form-group">
							<div class="col-sm-offset-1 col-sm-6">
								<button id="btn_submit" type="submit" class="btn btn-default">保存</button>
								<button type="reset" class="btn btn-default">重置</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

</body>
</html>